#include<stdio.h>

int hanni(int n, char a, char b, char c, int i);
int main(int argc, char *argv[])
{
	int n;
	scanf("%d", &n);
	hanni(n, 'A', 'C', 'B', n);
	return 0;
}


int hanni(int n, char a, char c, char b, int i){
	if(1 == n){
		printf("第%d个盘%c -> %c\n", i, a, c);
		return 1;
	}
	hanni(n-1, a, b, c, i-1);
	printf("第%d个盘%c -> %c\n", i, a, c);
	hanni(n-1, b, c, a, i-1);
}
